<?php
class Application_Form_AddFlower extends Zend_Form
{

	public function init()
	{
		$this->setName('addflower');
		$tengiohoa = new Zend_Form_Element_Text('tengiohoa');
		$tengiohoa->setLabel('Tên giỏ hoa :')
		->setRequired(true)
		->addFilter('StripTags')
		->addFilter('StringTrim')
		->addValidator('NotEmpty');
		
		$dongiaban = new Zend_Form_Element_Text('dongiaban');
		$dongiaban->setLabel('Đơn giá bán :')
		->setRequired(true)
		->addFilter('StripTags')
		->addFilter('StringTrim')
		->addFilter('Int')
		->addValidator('Digits')->addValidator('NotEmpty');
		

		$slton = new Zend_Form_Element_Text('slton');
		$slton->setLabel('Số lượng tồn :')
		->setRequired(true)
		->addFilter('StripTags')
		->addFilter('StringTrim')
		->addFilter('Int')
		->addValidator('Digits')->addValidator('NotEmpty');
		
		$img_url = new Zend_Form_Element_Text('img_url');
		$img_url->setLabel('Tên file ảnh :')
		->setRequired(true)
		->addFilter('StripTags')
		->addFilter('StringTrim')
		->addValidator('NotEmpty');
		
		
		$submit = new Zend_Form_Element_Submit('submit');
		$submit->setAttrib('id', 'submitbutton');
		
		$reset = new Zend_Form_Element_Reset('reset');
		
		
		//create select connect to loaigiohoa datatable
		$loai_id= new Zend_Form_Element_Select('loai_id');
		$loai_id->setLabel('Loại giỏ hoa :');
		$loai_data= new Application_Model_LoaiGioHoa();
		$loai_table=$loai_data->fetchAll()->toArray();
		foreach ($loai_table as $value)
		{
			$loai_id->addMultiOption($value['id'],$value['tenloai']);
		}
		//end

		$this->addElements(array($loai_id,$tengiohoa, $dongiaban,$slton,$img_url,$reset, $submit));
	}
}